import React from "react"
import { AppContext } from "./App"

export default function withContext(Component) {
  return props => {
    return (
      <AppContext.Consumer>
        {({ state, actions }) => {
          return <Component {...props} data={state} actions={actions} />
        }}
      </AppContext.Consumer>
    )
  }
}
